package com.sw.passbook.merchants.sercurity;

/**
 * @Desc: 用ThreadLocal 去单独存储每个线程携带的token信息
 * @Author: wusonghe
 * @Date: 2018/11/27 17:30
 */
public class AccessTokenContext {

    private static final ThreadLocal<String> tokenThreadLocal = new ThreadLocal<String>();

    public static String getToken() {
        return tokenThreadLocal.get();
    }

    public static void setToken(String token) {
        tokenThreadLocal.set(token);
    }

    public static void clearAccessKey() {
        tokenThreadLocal.remove();
    }
}
